"""
-*- coding: utf-8 -*-
@Author  : Link
@Time    : 2023/2/22 11:03
@Site    : 
@File    : app_project.py
@Software: PyCharm
@Remark  : 
"""
import os
from typing import List, Dict


class AppProject:
    """
    @DATE   : 20221225
    @AUTHOR : Link
    """
    DEBUG: bool = True
    LOGGER_ID: int = None

    PART_TYP = "DEMO"
    JOB_NAM = "DEMO_4S_V0P0_20221205"
    TEST_COD = "CP1"

    OP_UI_PORT: int = 12012
    HUB_TCP_PORT: int = 10011  # 链接的Device Tcp端口
    SUMMARY_TCP_PORT: int = 10010  # 链接的Summary报表的 Tcp端口

    LIMIT_CSV_PATH = r"DEMO_CP1_4S_25C_V0P00.csv"
    STDF_SAVE_PATH = r"D:\\DataSave"
    STDF_SAVE_NAME = "{PART_TYP}_{TEST_COD}_{LOT_ID}_{SBLOT_ID}_{SETUP_T}_S{DUT}.stdf"
    LOG_SAVE_NAME: str = "{PART_TYP}_{TEST_COD}_{LOT_ID}_{SBLOT_ID}_{FLOW_ID}_{SETUP_T}_S{DUT}.log"
    LOT_INFO_PATH = r"D:\\LotInfo"

    REBOOT_TEST_QTY: int = 100

    WAIT_ENUM_TIME: float = 10
    WAIT_DELAY_TIME: float = 2
    WAIT_ENUM_DELAY_TIME: float = 2
    WAIT_ENUM_DELAY_TIMES: int = 3
    READ_DISK_TIMES: int = 50
    WRITE_DISK_TIMES: int = 3
    RANDOM_WRITE_DISK_TIMES: int = 1

    DUT_NUM: List[int] = [0, 1]  # 工位数&工位号
    SERIAL_PORT: List[str] = ["COM1", "COM2"]  # 工位对应的链接COM口
    SERIAL_PORT_DICT: Dict[int, str] = dict(zip(DUT_NUM, SERIAL_PORT))

    HUB_CONNECT_LEVEL: int = 3
    HUB_BUS: int = 1
    HUB_PORTS: int = 4

    def __init__(self):
        if not os.path.exists(self.STDF_SAVE_PATH):
            os.makedirs(self.STDF_SAVE_PATH)
        if not os.path.exists(self.LOT_INFO_PATH):
            os.makedirs(self.LOT_INFO_PATH)
